import request from '@/config/axios'

export interface MajorVO {
  id: number
  majorName: string
  majorCode: string
  schoolId: number
  collegeId: number
  sourceType: number
  sourceId: string
  deptId: number
}

// 查询专业分页
export const getMajorPage = async (data) => {
  return await request.post({ url: `/cmis/major/page`, data })
}
// 查询专业列表
export const getMajorList = async (data) => {
  return await request.post({ url: `/cmis/major/query`, data })
}

// 查询专业列表
export const queryMajorList = async (data) => {
  return await request.post({ url: `/cmis/major/query`, data })
}

// 查询专业详情
export const getMajor = async (id: number) => {
  return await request.get({ url: `/cmis/major/get?id=` + id })
}

// 新增专业
export const createMajor = async (data: MajorVO) => {
  return await request.post({ url: `/cmis/major/create`, data })
}

// 修改专业
export const updateMajor = async (data: MajorVO) => {
  return await request.put({ url: `/cmis/major/update`, data })
}

// 删除专业
export const deleteMajor = async (id: number) => {
  return await request.delete({ url: `/cmis/major/delete?id=` + id })
}

// 导出专业 Excel
export const exportMajor = async (params) => {
  return await request.download({ url: `/cmis/major/export-excel`, params })
}

// 下载专业 Excel模版
export const importTemplate = async () => {
  return await request.download({ url: `/cmis/major/get-import-template` })
}

// 导入专业 Excel
export const importMajor = async (data) => {
  return await request.upload({ url: `/cmis/major/import-excel`, data: data })
}

// 批量删除专业
export const batchDeleteMajor = async (ids: Array<string>) => {
  return await request.delete({ url: `/cmis/major/batchDelete?ids=` + ids })
}
